package com.ssm.controller;

import com.ssm.pojo.Tang;
import com.ssm.service.TangService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class Tangcontroller {

    @Autowired
    @Qualifier(value = "tangServiceImpl") // 有多个实现类的话就要加上这个，这只有一个可加可不加
    private TangService tangService;

    @RequestMapping("/allBook")
    public String allBook(Model model) {
        List<Tang> tangs = tangService.selectAll();
        model.addAttribute("tangs", tangs);
        model.addAttribute("aa", "tangs");
        return "allBook";
    }

}
